<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class HT_Model_administrator_models_seractivities extends Zend_Db_Table {//ten class fai viet hoa

   protected $_db;

    public function __construct() {
        $this->_name = "ser_activities";
        $this->_db = Zend_Registry::get('dbMain');
        parent::init();
    }
    public function getServiceActivities($phaseId){
        $sql = "select * from ser_activities where phase_id = ".$phaseId;        
        $retval = $this->_db->fetchAll($sql);            
        return $retval;
    }
    public function getServiceActivitiesPreg($bbweek){
        //$sql = "SELECT * FROM ser_activities WHERE phase_id = 2 AND time_id = (SELECT id FROM ser_time WHERE ser_time.time_value = $bbweek)";        
        //$sql = "SELECT * FROM ser_activities WHERE time_id = (SELECT id FROM ser_time WHERE ser_time.time_value = $bbweek)";            
        $sql = "SELECT * FROM ser_activities WHERE time_id in (SELECT id FROM ser_time WHERE ser_time.time_value = $bbweek)";            
        
        $retval = $this->_db->fetchAll($sql);            
        return $retval;
    }    
    public function findById($id){
        $sql = "select * from vouchers where id = $id";
        $retval = $this->_db->fetchRow($sql);
        return $retval;
    }
}

?>
